home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Otherware
/
Otherware_1_SB_Development.iso
/
mac
/
sysext
/
init
/
bail.cpt
/
Bail ƒ
/
Bail Source
/
LoadBail.c
< prev
next >
Wrap
Text File
|
1992-06-18
|
657b
|
29 lines
//Loader for Bail
#define _InitApplication 0xAAFA
void
main ( void )
{
long oldAddr ;
Handle code ;
unsigned short * ptr ;
long keys [ 4 ] ;
code = GetResource ('Bail' , 128 );
GetKeys ( keys ); //Don't load if option key is down
if ( code && ! ( keys [ 1 ] & 0x4 ) ) {
DetachResource ( code ) ;
HLock ( code ) ;
oldAddr = NGetTrapAddress ( _InitApplication , ToolTrap ) ;
NSetTrapAddress ( ( long ) * code , _InitApplication , ToolTrap ) ;
ptr = ( unsigned short * ) * code ;
while ( * ptr != 0xeeee ) ptr ++ ;
* ( long * ) ptr = oldAddr ;
FlushDataCache ( ) ;
FlushInstructionCache ( ) ;
} else {
SysBeep ( 20 ) ;
}
}